home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / graphics / buttons.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-05-16  |  2.4 KB  |  77 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "Bunch of Control Buttons"
  4.    ClientHeight    =   3615
  5.    ClientLeft      =   1650
  6.    ClientTop       =   2250
  7.    ClientWidth     =   7575
  8.    Height          =   4020
  9.    Left            =   1590
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   3615
  13.    ScaleWidth      =   7575
  14.    Top             =   1905
  15.    Width           =   7695
  16.    Begin PictureBox Picture1 
  17.       AutoSize        =   -1  'True
  18.       BorderStyle     =   0  'None
  19.       Height          =   2415
  20.       Left            =   225
  21.       Picture         =   BUTTONS.FRX:0000
  22.       ScaleHeight     =   5
  23.       ScaleMode       =   0  'User
  24.       ScaleWidth      =   10
  25.       TabIndex        =   1
  26.       Top             =   195
  27.       Width           =   7215
  28.    End
  29.    Begin CommandButton Command11 
  30.       Caption         =   "Quit"
  31.       Height          =   375
  32.       Left            =   6105
  33.       TabIndex        =   0
  34.       Top             =   2955
  35.       Width           =   1215
  36.    End
  37.    Begin Label LocationText 
  38.       Alignment       =   2  'Center
  39.       BorderStyle     =   1  'Fixed Single
  40.       Height          =   375
  41.       Left            =   210
  42.       TabIndex        =   2
  43.       Top             =   2985
  44.       Width           =   3690
  45.    End
  46. Sub Command11_Click ()
  47.     End
  48. End Sub
  49. Sub Form_Load ()
  50.     Picture1.ScaleWidth = 10
  51.     Picture1.ScaleHeight = 5
  52. End Sub
  53. Sub Picture1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  54.     Dim msgString As String
  55.     Dim ix As Integer
  56.     Dim iy As Integer
  57.     ' extract the integer part of the mouse x & y position
  58.     ix = Int(X)
  59.     iy = Int(Y)
  60.     ' if the mouse is over the space between buttons
  61.     ' we wish to do nothing.  empirical testing
  62.     ' indicates that if the fractional part of x
  63.     ' is greater than .84 or the fraction part of y
  64.     ' is greater than .74 the mouse is over the space
  65.     ' between buttons.
  66.     '
  67.     If ((X - ix) < .85) And ((Y - iy) < .75) Then
  68.         msgString = "you hit button " + Str$(ix * 5 + iy + 1)
  69.         MsgBox (msgString)
  70.     End If
  71. End Sub
  72. Sub Picture1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  73.     Dim msgString As String
  74.     msgString = "x = " + Str$(X) + "  y = " + Str$(Y)
  75.     LocationText.Caption = msgString
  76. End Sub
  77.